#!/usr/bin/env python
# encoding: utf-8

"""This example shows the usage of the Translator class.
To use the i18n with spyro you have to customize the i18n section in your
configuration file, declaring at least the "domain" (the .mo file name), 
"localedir" the directory in which look for .mo files (default the system one),
"installed_langs" (a string comma separated, including all languages avaiable).

You can also try switching Translator.get_user_lang() but if "fallback" is
false and the user language is not found it will raise a 500 error page.
"""

from spyro import *
from spyro.i18n import Translator

class Root(WebPage):
    def index(self):
        i18n = Translator()
        i18n.set_lang("it")
        #i18n.get_user_lang()
        self.response.from_template("index.html", translations=i18n.translate())
